<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<title></title>
		<link rel="stylesheet" type="text/css" href="resource/css/bootstrap.min.css"/>
		<link rel="stylesheet" type="text/css" href="./resource/fonts/iconfont.css"/>
		<link rel="stylesheet" type="text/css" href="resource/css/jedate.css"/>
		<link rel="stylesheet" type="text/css" href="resource/css/common.css"/>
		<link rel="stylesheet" type="text/css" href="../resources/layui/css/layui.css"/>
		<style>
			.saixuan:after{width: 0;}
			.layui-form-pane .layui-input-block{margin-left: 0;}

			@media screen and (max-width: 1280px) {
				.layui-form-pane .layui-form-label{width: 108px;}

			}

			.layui-form-item .layui-input-inline{width: 165px;}
			.masksx .forms{padding-left: 0;text-align: center;}
			.masksx{width: 650px;}
			.mask input{width: 100%!important;}
			.mask .layui-select-title{width: 480px;}
			.layui-inline{margin-bottom: 10px;}
			.layui-upload{ text-align: left;}
			#demo2 img{width: 90px; height: 90px;}
			.imgs{position: relative;width: 90px; height: 90px; float: left; margin-right: 10px; margin-bottom: 10px;}
			._ingshan{position: absolute;right: -5px;top: -5px; background-color:#ff0000;border: 1px solid #FF0000;
				border-radius: 50%;width: 22px;height: 22px;text-align: center;}
			@media only screen and (min-width: 321px) and (max-width: 1024px) {
				.layui-form-pane .layui-input-inline {width: 100%;}
				._inkong{ width:auto!important; }
				.layui-form-item .layui-input-inline{width: 100%;}
				.masksx{height: 50%;}
			}

			@media screen and (max-width: 750px){
				.MOVE_queryon .layui-form-item {
					width: 80%;
				}
				.layui-form-item{padding: 0;}
				.MOVE_footer{text-align: right;}
				.MOVE_footer a{color: #FFF;font-size: 20px;line-height: 30px;
					padding: 10px;background-color: #F5A721;height: 100%;position: absolute;right: 0;}
				.tijiao{z-index: 9999;}
			}
			._ingshan .layui-icon{ color: #fff; margin-top: -2px;}
			.danhao{display: none; padding-left: 32px;}
			.danhao .layui-form-label,.danhao ._inkong{float: left;}
			.danhao ._inkong{margin-bottom: 10px; }
			.masksx ._inkong{}
			.layui-table-cell{text-align: left;}
			.layui-form-select{width: 80%!important;}
			.layui-btn{ display: block; padding: 0; text-align:center;width:90px; height: 90px; border-radius: 5px; background-color: #f5f5f5;}
			.layui-btn .layui-icon{ text-align: center; color: #999; font-size: 66px; margin: 0 auto;}
			.layui-quote-nm{ padding: 0; border:none;}
		</style>

	</head>
	<body>
		<div class="container-fluid">
			<div class="row mheader">
				<div class="col-xs-2 text-left"><a href="javascript:;" onclick="javascript:history.back(-1);"><span class="iconfont icon-fanhui"></span></a></div>
				<div class="col-xs-8"><h2>个人资料</h2></div>
				<div class="col-xs-2"></div>
			</div>
			<div class="row">
				<div class="com-form" style="padding-bottom: 70px;">
					<form class="form-horizontal">
						<!--<div class="form-group">-->
					    	<!--<label class="col-xs-3 control-label" for="">合同编号:</label>-->
					    	<!--<div class="col-xs-9">-->
					    		<!--<div class="select-box">-->
						    		<!--<span class="caret"></span>-->
									<!--<select class="form-control">-->
									  <!--<option>GC201701</option>-->
									  <!--<option>GC201702</option>-->
									  <!--<option>GC201703</option>-->
									  <!--<option>GC201704</option>-->
									  <!--<option>GC201705</option>-->
									<!--</select>-->
								<!--</div>-->
							<!--</div>-->
						<!--</div>-->

						<!--<div class="form-group">-->
					    	<!--<label class="col-xs-3 control-label" for="">姓名:</label>-->
					    	<!--<div class="col-xs-9">-->
					    		<!--<input type="text" class="form-control" id="" placeholder="" value="张三">-->
					    	<!--</div>	-->
					  	<!--</div>-->

						<!--<div class="form-group">-->
							<!--<label class="col-xs-3 control-label" for="">联系方式:</label>-->
							<!--<div class="col-xs-9">-->
								<!--<input type="text" class="form-control" id="" placeholder="" value="张三">-->
							<!--</div>-->
						<!--</div>-->
						<!--<div class="form-group">-->
							<!--<label class="col-xs-3 control-label" for="">身份证号:</label>-->
							<!--<div class="col-xs-9">-->
								<!--<input type="text" class="form-control" id="" placeholder="" value="张三">-->
							<!--</div>-->
						<!--</div>-->
						<!--<div class="form-group">-->
							<!--<label class="col-xs-3 control-label" for="">户籍地址:</label>-->
							<!--<div class="col-xs-9">-->
								<!--<input type="text" class="form-control" id="" placeholder="" value="张三">-->
							<!--</div>-->
						<!--</div><div class="form-group">-->
						<!--<label class="col-xs-3 control-label" for="">通讯地址:</label>-->
						<!--<div class="col-xs-9">-->
							<!--<input type="text" class="form-control" id="" placeholder="" value="张三">-->
						<!--</div>-->
					<!--</div><div class="form-group">-->
						<!--<label class="col-xs-3 control-label" for="">电子邮箱:</label>-->
						<!--<div class="col-xs-9">-->
							<!--<input type="text" class="form-control" id="" placeholder="" value="张三">-->
						<!--</div>-->
					<!--</div>-->
						<div class="form-group">
							<label class="col-xs-3 control-label">上传头像:</label>
							<div class="layui-input-inline col-xs-9">
								<div class="layui-upload">
									<button type="button" class="layui-btn" id="test2"><i class="layui-icon">&#xe654;</i> </button>
									<blockquote class="layui-elem-quote layui-quote-nm">
										<div class="layui-upload-list clearfix" id="demo2"></div>
									</blockquote>
								</div>
							</div>
						</div>
					  	<div class="form-groups">
					    	<label class="col-xs-3 control-label" for="">&nbsp;</label>
					    	<div class="col-xs-9">
					    		<button type="button" class="btn btn-info btn-block">保存</button>
					    	</div>
					  	</div>
					  <!---->
					 </form>


				</div>
			
			</div>
		</div>
	</body>
</html>
<script src="https://cdn.bootcss.com/jquery/2.2.4/jquery.min.js"></script>
<script src="resource/js/bootstrap.min.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" src="./resource/js/style.js"></script>
<script src="https://cdn.bootcss.com/jquery/2.2.4/jquery.min.js"></script>
<script src="../resources/layui/layui.all.js" type="text/javascript" charset="utf-8"></script>

<script>
    var _picurls=new Array();

    layui.use(['form', 'layedit', 'laydate','table','element','upload','flow'], function() {
        var form = layui.form
            , layer = layui.layer
            , layedit = layui.layedit
            , laydate = layui.laydate
            , table = layui.table
            , element = layui.element
            , flow = layui.flow
            , upload = layui.upload;

        var img_arr=new Array();

        $(document).on('click','._ingshan',function () {
            console.log($(this).prev().attr('src'))
            var shanSRC=$(this).prev().attr('src');
            $('#test2').show();
            $(this).parent().remove();
            $.each(_picurls,function(index,item){       //删除功能
                // index是索引值（即下标）   item是每次遍历得到的值；
                if(item==shanSRC){
                    _picurls.splice(index,1);
                }
            });
            console.log(_picurls)
        })

        //普通图片上传
        var uploadInst = upload.render({
            elem: '#test2'
            ,url: urls+'api/public/uploadImg.do'
            ,size:1024*10
            ,before: function(obj){
                //预读本地文件示例，不支持ie8
            }
            ,done: function(res){
                //上传完毕
                console.log(res)

                window.tool.alert(res.msg);
				$('#test2').hide();
                _picurls=[];
                _picurls.push(res.data[0]);         //返回的数据  放进数组中以便传递
                $('#demo2').append('<div class="imgs"><img src="'+urls+ res.data[0] +'" class="layui-upload-img"> <span class="_ingshan"><i class="layui-icon">&#x1006;</i> </span></div>')

            }
            ,error: function(){
                //演示失败状态，并实现重传
                var demoText = $('#demoText');
                demoText.html('<span style="color: #FF5722;">上传失败</span> <a class="layui-btn layui-btn-mini demo-reload">重试</a>');
                demoText.find('.demo-reload').on('click', function(){
                    uploadInst.upload();
                });
            }
        });
    });

	$(function(){
	    var name = $(".u-name");
	    if ( getP() ){
			var arr = getP().split("|");
	        $(name).text(arr[0]);
		} else {
			$(name).html('<a href="login.html" >立即登录</a>');
			$("eBtn").remove();
		}
		var arrs=getCookie('yanzheng');
	    arrs=arrs.split('|');
		console.log(arrs)
		ajaxs('api/user/loadUserDetail.do','post',{'opid':arrs[2]},function (data) {
			console.log(data);
			var datas=data.data;

			$('.form-group').before('<div class="form-group">' +
                '    <label class="col-xs-3 control-label" for="">姓名:</label>' +
                '    <div class="col-xs-9">' +
                '    <input type="text" class="form-control" name="contack" id="" placeholder="" value="'+datas.contack+'">' +
                '    </div>' +
                '  </div>' +
                '<div class="form-group">' +
                '<label class="col-xs-3 control-label" for="">联系方式:</label>' +
                '<div class="col-xs-9">' +
                '<input type="number" name="motel" class="form-control" id="" placeholder="" value="'+datas.motel+'">' +
                '</div>' +
                '</div>' +
                '<div class="form-group">' +
                '<label class="col-xs-3 control-label" for="">身份证号:</label>' +
                '<div class="col-xs-9">' +
                '<input type="number" name="securid" id="" class="form-control" placeholder="" value="'+datas.securid+'">' +
                '</div>' +
                '</div>' +
                '<div class="form-group">' +
				'<label class="col-xs-3 control-label" for="">通讯地址:</label>' +
				'<div class="col-xs-9">' +
				'<input type="text" name="addr" id="" class="form-control" placeholder="" value="'+datas.addr+'">' +
				'</div>' +
				'</div>'+
                '<div class="form-group">' +
                '<label class="col-xs-3 control-label" for="">户籍地址:</label>' +
                '<div class="col-xs-9">' +
                '<input type="text" name="addr2" id="" class="form-control" placeholder="" value="'+datas.addr2+'">' +
                '</div>' +
                '</div><div class="form-group">' +
                '<label class="col-xs-3 control-label" for="">电子邮箱:</label>' +
                '<div class="col-xs-9">' +
                '<input type="text" name="email" id="" class="form-control" placeholder="" value="'+datas.email+'">' +
                '</div>' +
                '</div>')


        })
		$('.btn').click(function () {
			console.log($('form').serialize())
			var datas=$('form').serialize();
			datas='opid='+arrs[2]+'&'+datas;
			console.log(datas)
			var pan=true;
			$('input').each(function (k,v) {
				if($(v).val().length<=0&&$(v).attr('type')!="file"){
                    window.tool.alert('请完善页面信息');
                    pan=false;
					return;
                }
            })
            _picurls=_picurls.join(',');

			if(pan){
			  	ajaxs('api/user/upUserInfo.do','post',{'opid':arrs[2],'contack':$('[name="contack"]').val(),'motel':$('[name="motel"]').val(),'securid':$('[name="securid"]').val(),'addr':$('[name="addr"]').val(),'addr2':$('[name="addr2"]').val(),'email':$('[name="email"]').val(),'idphoto':_picurls},function (data) {
					console.log(data)
					if(data.code==0){
                        window.tool.alert(data.msg);
						location.href='./my.html';
                    }else{
                        window.tool.alert(data.msg);
                    }
                })


			}


        })
	});

    /**
	 * 	退出
     */
	function exitlogin() {
        delCookie("yanzheng");
        //退出处理缓存
        window.tool.exit();
        window.tool.clearCache();
        location.reload();
    }

    /**
	 * 	清缓存
     */
    function clearCache() {
        //app端生效
        window.tool.clearCache();
    }

</script>







